package com.zhxq.ai.tools;

import com.zhxq.ai.domain.InterviewReport;
import com.zhxq.ai.service.IInterviewReportService;
import com.zhxq.common.utils.UserThreadLocal;
import groovy.util.logging.Slf4j;
import lombok.RequiredArgsConstructor;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
@Slf4j
public class ReportTools {

    private final IInterviewReportService interviewReportService;

    @Tool(description= "生成面试报告")
    public String saveReport(
            @ToolParam(description = "面试职位") String position,
            @ToolParam(description = "综合评分") Integer score,
            @ToolParam(description = "整体评价") String evaluate,
            @ToolParam(description = "技术亮点") String highlight,
            @ToolParam(description = "不足之处") String deficiency,
            @ToolParam(description = "建议") String suggestion,
            @ToolParam(description = "客户ID") Long memberId) {
        InterviewReport report = new InterviewReport();
//        Long userId = UserThreadLocal.getUserId();
//        report.setMemberId(userId);
        System.out.println("****************************保存面试报告方法运行成功*****************************************");
        report.setPosition(position);
        report.setScore(score);
        report.setEvaluate(evaluate);
        report.setHighlight(highlight);
        report.setDeficiency(deficiency);
        report.setSuggestion(suggestion);
        report.setMemberId(memberId);
        interviewReportService.save(report);
        System.out.println("****************************插入数据库成功*****************************************");
        return report.getId().toString();
    }
}
